package com.suisung.shopsuite.agent.componet.anwser;

import com.suisung.shopsuite.agent.componet.anwser.base.AiResponseHandler;
import com.suisung.shopsuite.agent.componet.anwser.base.ResponseContext;

import java.util.LinkedList;
import java.util.List;

// 链式调用管理器，类似Netty的Pipeline
public class AiResponsePipeline {
    private final List<AiResponseHandler> handlers = new LinkedList<>();

    // 添加处理器
    public AiResponsePipeline addLast(AiResponseHandler handler) {
        handlers.add(handler);
        return this;
    }

    // 启动链式处理
    public void process(ResponseContext context) {
        new DefaultAiResponseHandlerChain(handlers).proceed(context);
    }
}
